package com.jiliang.auth.controller;


import com.jiliang.auth.controller.req.AuthSpecFuncReqForm;
import com.jiliang.auth.controller.res.AuthFuncResForm;
import com.jiliang.auth.domain.AuthFuncBo;
import com.jiliang.auth.domain.AuthSpecFuncBo;
import com.jiliang.auth.service.AuthFuncService;
import com.jiliang.common.bean.BeanCopierDsUtil;
import com.jiliang.common.bean.BeanCopyDsUtil;
import com.jiliang.common.result.WebResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 特殊的角色功能接口（子系统交叉管理）
 * 
 * 
 */
@RestController
@RequestMapping(value = "/authFunc/spec")
//@Api("AuthRoleFuncController相关的api")
public class AuthSpecRoleFuncController {

    @Autowired
    AuthFuncService authFuncService;

//    @ApiOperation(value = "特殊模式下查询功能列表", notes = "特殊模式下查询功能列表")
//    @ApiImplicitParam(name = "reqForm ", value = "查询参数", required = true, dataType = "AuthSpecFuncReqForm ")
    @RequestMapping(value = "/selSpecAuthFuncList", method = RequestMethod.POST)
    public WebResult selListByRoleSysId(@RequestBody AuthSpecFuncReqForm reqForm, BindingResult result) {
//        ApiResult webAuthResult = ApiAuthVerification.getResult(reqForm, result);
//        if (!webAuthResult.isSuccess) {
//            return webAuthResult.getWebResult();
//        }
        AuthSpecFuncBo specFuncBo = new AuthSpecFuncBo();
        BeanCopyDsUtil.copyProperties(reqForm, specFuncBo);
        List<AuthFuncBo> funcList = authFuncService.selSpecAuthFuncList(specFuncBo);
        List<AuthFuncResForm> resList = BeanCopierDsUtil.copyPropertiesOfList(funcList, AuthFuncResForm.class);
        return WebResult.success(resList);
    }
}
